import '../Scss/beihuan.scss'
import { lazy, Suspense, useState } from 'react'
import { commonUrl } from '../../Configure/CommonParameter'
import { v4 as uuidv4 } from 'uuid'
import { PlugInUnit } from '../PlugInUnit'

const SignUpA02 = lazy(() => import('../SignUpA02'))
const CodeUp = lazy(() => import('../CodeUp'))

const BHLoginPage = ({ imageUrl, codeState, toggle, uuid, title }) => {
    const [QRUuid] = useState(uuidv4())
    return (
        <Suspense fallback={<div>北环登录</div>}>
            <div className="beihuan">
                <img className="LoginBack" src={`${imageUrl}LoginBack.gif`} alt="" />
                <div className="top">
                    <img src={`${imageUrl}TopNavA01.gif`} alt="" />
                    <div>{title}</div>
                </div>
                <img className="bottom" src={`${imageUrl}Bottom.gif`} alt="" />

                <div className="LoginBox">
                    <div className="title">系统登录</div>
                    <img className="LoginBoxBack" src={`${imageUrl}Sign.png`} alt="" />
                    <div className="SingUp">
                        {codeState ? (
                            <CodeUp
                                codeState={codeState}
                                codeStyle={commonUrl + 'code.css'}
                                QRUuid={QRUuid}
                                ProjectUuid={uuid}
                            />
                        ) : (
                            <SignUpA02 img={imageUrl + 'SignBtn.png'} />
                        )}
                        <PlugInUnit />
                    </div>
                </div>
            </div>
        </Suspense>
    )
}
export default BHLoginPage
